﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;

namespace wintest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string constr = "Provider=SQLOLEDB;Data Source=YF-BENRYYANG;Integrated Security=SSPI";
            string constr2 = "Provider=sqloledb; Data Source=YF-BENRYYANG; Initial Catalog=BySoft.PDM; User Id=sa; Password=123456;OLE DB Services = -4;";
            // string constr3 = "Provider=SQLNCLI; Server=YF-BENRYYANG; Database=BySoft.PDM; UID=sa; PWD=123456;";
            for (int i = 1; i < 100000; i++)
            {
                //using (OleDbConnection olecon = new OleDbConnection(constr2))
                //{
                //    olecon.Open();
                //    if (olecon.State == ConnectionState.Open)
                //    {
                //        this.textBox1.AppendText(i.ToString() + "\r\n");
                //        this.textBox1.Update();
                //    }
                //}

                OleDbConnection olecon = new OleDbConnection(constr2);
                olecon.Open();
                if (olecon.State == ConnectionState.Open)
                {
                    this.textBox1.AppendText(i.ToString() + "\r\n");
                    this.textBox1.Update();
                }

            }
        }
    }
}
